package gestionTransportObjetsGenerated;

/**
 * Interface definition : GestionColis
 * 
 * @author OpenORB Compiler
 */
public class _GestionColisStub extends org.omg.CORBA.portable.ObjectImpl
        implements GestionColis
{
    static final String[] _ids_list =
    {
        "IDL:gestionTransportObjetsGenerated/GestionColis:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = gestionTransportObjetsGenerated.GestionColisOperations.class;

    /**
     * Operation connaitreEtat
     */
    public gestionTransportObjetsGenerated.EtatColis[] connaitreEtat(String numAdh)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("connaitreEtat",true);
                    _output.write_string(numAdh);
                    _input = this._invoke(_output);
                    gestionTransportObjetsGenerated.EtatColis[] _arg_ret = gestionTransportObjetsGenerated.EtatColisListHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("connaitreEtat",_opsClass);
                if (_so == null)
                   continue;
                gestionTransportObjetsGenerated.GestionColisOperations _self = (gestionTransportObjetsGenerated.GestionColisOperations) _so.servant;
                try
                {
                    return _self.connaitreEtat( numAdh);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation newColis
     */
    public void newColis(gestionTransportObjetsGenerated.Enveloppe env)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("newColis",true);
                    gestionTransportObjetsGenerated.EnveloppeHelper.write(_output,env);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("newColis",_opsClass);
                if (_so == null)
                   continue;
                gestionTransportObjetsGenerated.GestionColisOperations _self = (gestionTransportObjetsGenerated.GestionColisOperations) _so.servant;
                try
                {
                    _self.newColis( env);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation obtenirColis
     */
    public gestionTransportObjetsGenerated.Enveloppe obtenirColis(String numEnv)
        throws gestionTransportObjetsGenerated.COLIS_INCONNU
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("obtenirColis",true);
                    _output.write_string(numEnv);
                    _input = this._invoke(_output);
                    gestionTransportObjetsGenerated.Enveloppe _arg_ret = gestionTransportObjetsGenerated.EnveloppeHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionTransportObjetsGenerated.COLIS_INCONNUHelper.id()))
                    {
                        throw gestionTransportObjetsGenerated.COLIS_INCONNUHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("obtenirColis",_opsClass);
                if (_so == null)
                   continue;
                gestionTransportObjetsGenerated.GestionColisOperations _self = (gestionTransportObjetsGenerated.GestionColisOperations) _so.servant;
                try
                {
                    return _self.obtenirColis( numEnv);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation informerColisDestinataire
     */
    public void informerColisDestinataire(String numEnv, String libZone)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("informerColisDestinataire",true);
                    _output.write_string(numEnv);
                    _output.write_string(libZone);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("informerColisDestinataire",_opsClass);
                if (_so == null)
                   continue;
                gestionTransportObjetsGenerated.GestionColisOperations _self = (gestionTransportObjetsGenerated.GestionColisOperations) _so.servant;
                try
                {
                    _self.informerColisDestinataire( numEnv,  libZone);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation obtenirColisDest
     */
    public String[] obtenirColisDest(String numAdh)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("obtenirColisDest",true);
                    _output.write_string(numAdh);
                    _input = this._invoke(_output);
                    String[] _arg_ret = gestionTransportObjetsGenerated.EnveloppesDestHelper.read(_input);
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("obtenirColisDest",_opsClass);
                if (_so == null)
                   continue;
                gestionTransportObjetsGenerated.GestionColisOperations _self = (gestionTransportObjetsGenerated.GestionColisOperations) _so.servant;
                try
                {
                    return _self.obtenirColisDest( numAdh);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
